package com.acme;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class AddClientValidator {
	
	public void validateName(String name) {
		Pattern p = Pattern.compile("[a-zA-Z]+");
		Matcher m = p.matcher(name);
		boolean valid = m.matches();
		if(!valid) {
			throw new IllegalArgumentException("Field Name must contains only letters!");
		}
	}
	
	public void validateBalance(double balance) {
		if(balance < 0) {
			throw new IllegalArgumentException("Balance must be greater than zero!");
		}
	}
	
	public void validateOverdraft(double overdraft) {
		if(overdraft < 0) {
			throw new IllegalArgumentException("Overdraft must be greater than zero!");
		}
	}
}
